/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: HP
 * Date: 2023 -10 -09
 * Time: 21:08
 */
public class test2 {
    public static void main(String[] args) throws InterruptedException {
        Runnable r = () -> {
            for (int i = 0; i < 10; i++) {
                System.out.println(Thread.currentThread().getName()+" working...");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
            System.out.println(Thread.currentThread().getName() + "work finish");
        };
        Thread t1 = new Thread(r, "zhangsan");
        Thread t2 = new Thread(r, "lisi");
        t1.start();
        t2.start();
        t1.join();
        t2.join();
    }
}
